#pragma once

#include "scubserver.h"
#include "Method.h"
#include<vector>
#include<string>

struct MinesweeperOptions
{
	bool m_bDataTypes;
	bool m_bData;
	bool m_bPrototypes;

	MinesweeperOptions()
	{
		m_bDataTypes = false;
		m_bData = false;
		m_bPrototypes = false;
	}
};

struct Datalyzer :
    public Scubserver
{
public:
	//private:
    Scope*  m_pxCurrentScope;

	bool m_bMatchActiveVariable;
	bool m_bMatchActiveTypeDefiner;
	bool m_bThroughTypedefKeyword; //Special case for typedef

	int m_nLinenumber;

	int  m_nSerialNumber; //just for numbering
	//TODO: Remove

	Scope* m_pxLookaheadParen; 
	//We will need to check whether function call. May actually need to be scope-history

	std::vector<std::string> m_asVariable;
	std::vector<std::string> m_asDataTypeSpecifier;
	std::vector<std::string> m_asPrototype;

private:
	bool isKeyword(const std::string& s);
	bool isDataTypeSpecifier(const std::string& s);
	bool isDataTypeDefiner(const std::string& s);

	void matchTypeDefiner(Token& inToken);
	void matchVariable(Token& inToken);

public:
    virtual void onNewToken(Token& inToken);
    virtual void onScopeEntry(Scope& inNewScope, Scope& inOldScope);
    virtual void onScopeExit(Scope& inNewScope, Scope& inOldScope);
	virtual void setScope(Scope& inScope)
	{
		m_pxCurrentScope = &inScope;
	}

	void dump(MinesweeperOptions* pxOpt);
    Datalyzer(void);
    ~Datalyzer(void);
};
